// components/swiper/swiper.js
import { request } from '../../request/index'
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    background: Array
  },

  /**
   * 组件的初始数据
   */
  data: {
    index: 0
    // background: [
    //   {
    //     week:'今天',
    //     date:'4-9',
    //     content:[
    //       {time:"14:22",content:'今天的第一个fdfdasfasdfasfasdfasdfasfasdfasf团队课',name:'小肥星',title:'厚实你的腹肌',number:23,imgUrl:'http://129.28.168.85/img/1.png',avatar:'http://129.28.168.85/img/1.png'},
    // ]
    //   },
    //   {
    //     week:'明天',
    //     date:'4-10',
    //     content:[
    //       {content:'明天的第一个团队课',name:'小肥星',title:'厚实你的腹肌',number:23,imgUrl:'http://129.28.168.85/img/1.png',avatar:'http://129.28.168.85/img/1.png'},
    //       {content:'明天的第一个团队课',name:'小肥星',title:'厚实你的腹肌',number:23,imgUrl:'http://129.28.168.85/img/1.png',avatar:'http://129.28.168.85/img/1.png'},
    //       {content:'明天的第一个团队课',name:'小肥星',title:'厚实你的腹肌',number:23,imgUrl:'http://129.28.168.85/img/1.png',avatar:'http://129.28.168.85/img/1.png'},
    //  ]
    //   },
    //   {
    //     week:'周六',
    //     date:'4-11',
    //     content:[
    //       {content:'周六的第一个团队课',name:'小肥星',title:'厚实你的腹肌',number:23,imgUrl:'http://129.28.168.85/img/1.png',avatar:'http://129.28.168.85/img/1.png'},

    //     ]
    //   },
    //   {
    //     week:'周日',
    //     date:'4-12',
    //     content:[

    //     ]
    //   },
    //   {
    //     week:'周一',
    //     date:'4-13',
    //     content:[
    //       {content:'周一的第一个团队课',name:'小肥星',title:'厚实你的腹肌',number:23,imgUrl:'http://129.28.168.85/img/1.png',avatar:'http://129.28.168.85/img/1.png'},

    //     ]
    //   },
    //   {
    //     week:'周二',
    //     date:'4-14',
    //     content:[

    //     ]
    //   },
    //   {
    //     week:'周三',
    //     date:'4-15',
    //     content:[

    //     ]
    //   },
    // ]

  },

  /**
   * 组件的方法列表
   */
  methods: {
    indeChange(e) {
      this.setData({ index: e.detail.current })
    },
    participate(e) {
      var app = getApp()
      request({ url: app.globalData.root + 'api/participate', dataType: 'json', method: 'GET', data: { id: this.properties.background[this.data.index].content[e.currentTarget.dataset.i].id, userId: app.globalData.userId } }).then((res) => {
        this.triggerEvent("refreshTeam");
      })

    },
    onShareAppMessage() {
      return {
        title: 'swiper',
        path: 'page/component/pages/swiper/swiper'
      }
    },
    changeIndicatorDots() {
      this.setData({
        indicatorDots: !this.data.indicatorDots
      })
    },

    changeAutoplay() {
      this.setData({
        autoplay: !this.data.autoplay
      })
    },

    intervalChange(e) {
      this.setData({
        interval: e.detail.value
      })
    },

    durationChange(e) {
      this.setData({
        duration: e.detail.value
      })
    }
  }
})
